package config

//Config 中 添加mapstructure标签的主要作用是‌实现map类型数据与结构体的灵活映射
type Config struct {
	App      App      `mapstructure:"App"`
	PathInfo PathInfo `mapstructure:"PathInfo"` // 感觉Root可以归到App中
	DBConfig DB       `mapstructure:"DBConfig"`
	Http     Http     `mapstructure:"Http"`
}

type App struct {
	Name         string `mapstructure:"Name"`
	Env          string `mapstructure:"Env"`
	LogPath      string `mapstructure:"LogPath"`
	OssType      string `mapstructure:"OssType"`
	UploadDir    string `mapstructure:"UploadDir"`
	UploadMaxM   int64  `mapstructure:"UploadMaxM"`   //文件上传限制多少M
	LogParamShow bool   `mapstructure:"LogParamShow"` //参数绑定错误是否显示回前端
	LogParamErr  bool   `mapstructure:"LogParamErr"`
}

type PathInfo struct {
	Root string `mapstucture:"Root"`
}

type DB struct {
	Dsn             string `mapstructure:"Dsn"`
	MaxIdleConn     int    `mapstructure:"MaxIdleConn"`
	MaxOpenConn     int    `mapstructure:"MaxOpenConn"`
	ConnMaxIdleTime int    `mapstructure:"ConnMaxIdleTime"`
	ConnMaxLifeTime int    `mapstructure:"ConnMaxLifeTime"`
}

type Http struct {
	SiteUrl               string `mapstructure:"SiteUrl"`
	ApiPort               string `mapstructure:"ApiPort"`
	UseCrossMiddleware    bool   `mapstructure:"UseCrossMiddleware"` //是否开启跨域中间件，nginx解决的话此可关闭
	JwtKey                string `mapstructure:"JwtKey"`
	JwtAccessExpire       int64  `mapstructure:"JwtAccessExpire"`
	JwtRefreshTokenExpire int64  `mapstructure:"JwtRefreshTokenExpire"`
}
